{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "b84edb93",
   "metadata": {},
   "source": [
    "# 对比AI辅助之后人工提升\n",
    "\n",
    "```python\n",
    "def human_boost(data, x_column, hue, metrics, save_dir='img', ylim=0):\n",
    "    \"\"\"\n",
    "\n",
    "    Args:\n",
    "        data: 数据\n",
    "        x_column: X坐标的列名\n",
    "        hue: 使用什么列名来区分系列\n",
    "        metrics: 要评估那些指标。所有的指标必须要在data中。\n",
    "        save_dir: 保存位置，默认位当前目录的img文件夹。\n",
    "        ylim: Y轴的最小值。\n",
    "\n",
    "    Returns:\n",
    "\n",
    "    \"\"\"\n",
    "```\n",
    "文件形式参考如下：\n",
    "\n",
    "| Signature | Accuracy | AUC      | Sensitivity | Specificity | PPV      | NPV      | Precision | Recall   | F1       | Cohort     | group   |\n",
    "| --------- | -------- | -------- | ----------- | ----------- | -------- | -------- | --------- | -------- | -------- | ---------- | ------- |\n",
    "| Senior1   | 0.76     | 0.757903 | 0.653061    | 0.862745    | 0.820513 | 0.721311 | 0.820513  | 0.653061 | 0.727273 | Without AI | Senior  |\n",
    "| Senior2   | 0.73     | 0.729692 | 0.714286    | 0.745098    | 0.729167 | 0.730769 | 0.729167  | 0.714286 | 0.721649 | Without AI | Senior  |\n",
    "| Senior3   | 0.71     | 0.710084 | 0.714286    | 0.705882    | 0.7      | 0.72     | 0.7       | 0.714286 | 0.707071 | Without AI | Senior  |\n",
    "| Jounior1  | 0.69     | 0.693677 | 0.877551    | 0.509804    | 0.632353 | 0.8125   | 0.632353  | 0.877551 | 0.735043 | Without AI | Jounior |\n",
    "| Jounior2  | 0.66     | 0.657863 | 0.55102     | 0.764706    | 0.692308 | 0.639344 | 0.692308  | 0.55102  | 0.613636 | Without AI | Jounior |\n",
    "| Jounior3  | 0.69     | 0.691677 | 0.77551     | 0.607843    | 0.655172 | 0.738095 | 0.655172  | 0.77551  | 0.71028  | Without AI | Jounior |\n",
    "| Senior1   | 0.81     | 0.807723 | 0.693878    | 0.921569    | 0.894737 | 0.758065 | 0.894737  | 0.693878 | 0.781609 | With AI    | Senior  |\n",
    "| Senior2   | 0.82     | 0.820328 | 0.836735    | 0.803922    | 0.803922 | 0.836735 | 0.803922  | 0.836735 | 0.82     | With AI    | Senior  |\n",
    "| Senior3   | 0.81     | 0.810924 | 0.857143    | 0.764706    | 0.777778 | 0.847826 | 0.777778  | 0.857143 | 0.815534 | With AI    | Senior  |\n",
    "| Jounior1  | 0.8      | 0.802321 | 0.918367    | 0.686274    | 0.737705 | 0.897436 | 0.737705  | 0.918367 | 0.818182 | With AI    | Jounior |\n",
    "| Jounior2  | 0.79     | 0.787315 | 0.653061    | 0.921569    | 0.888889 | 0.734375 | 0.888889  | 0.653061 | 0.752941 | With AI    | Jounior |\n",
    "| Jounior3  | 0.83     | 0.831333 | 0.897959    | 0.764706    | 0.785714 | 0.886364 | 0.785714  | 0.897959 | 0.838095 | With AI    | Jounior |"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "52e09e06",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "from onekey_algo.custom.components.comp1 import human_boost\n",
    "\n",
    "# 替换你要使用的文件名即可。\n",
    "human_file = r'data/huaman.csv'\n",
    "data = pd.read_csv(human_file)\n",
    "human_boost(data, x_column='Cohort', hue='group', metrics=['AUC', 'Accuracy', 'Sensitivity', 'Specificity'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "01aec75a",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
